package com.talkweb.osmharmony;

import com.talkweb.osmharmony.slice.MainAbilitySlice;
import com.talkweb.osmharmony.utils.PermissionsUtils;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.security.SystemPermission;

public class MainAbility extends Ability {

    private String[] requestPermissions = {
            SystemPermission.WRITE_USER_STORAGE,
            SystemPermission.READ_USER_STORAGE,
            SystemPermission.LOCATION
    };

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setMainRoute(MainAbilitySlice.class.getName());
        PermissionsUtils.getInstance().requestPermissions(this, requestPermissions);
    }

    @Override
    public void onRequestPermissionsFromUserResult(int requestCode, String[] permissions, int[] grantResults) {
        PermissionsUtils.getInstance().onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}
